﻿<?php
defined("_VALID_ACCESS") || die('Direct access forbidden');
class SCTV_PaymentInstall extends ModuleInstall {
    public function install() {
	Base_ThemeCommon::install_default_theme($this->get_type());
	
	$fields = array(
		array('name'=>_M('Date Time'), 'type'=>'calculated', 'param'=>Utils_RecordBrowserCommon::actual_db_type('timestamp'), 'required'=>true, 'visible'=>true),
		array('name'=>_M('Content'), 'type'=>'text', 'param'=>128, 'required'=>true, 'visible'=>true),		
		array('name'=>_M('Receive'), 'type'=>'checkbox', 'required'=>true, 'visible'=>true),
		array('name'=>_M('Money'), 'type'=>'integer', 'required'=>true, 'visible'=>true, 'display_callback'=>array('SCTV_PaymentCommon', 'display_money')),
		array('name'=>_M('Remaining'), 'type'=>'calculated', 'param'=>Utils_RecordBrowserCommon::actual_db_type('integer'), 'required'=>true, 'visible'=>true, 'display_callback'=>array('SCTV_PaymentCommon', 'display_money'))
	);
	
	Utils_RecordBrowserCommon::install_new_recordset('SCTV_Payment', $fields);
	Utils_RecordBrowserCommon::set_caption('SCTV_Payment', _M('Payment'));
	Utils_RecordBrowserCommon::add_default_access('SCTV_Payment');
	
	Utils_RecordBrowserCommon::register_processing_callback('SCTV_Payment', array('SCTV_PaymentCommon', 'process_request'));
	
    return true;
}
 
    public function uninstall() {
	Base_ThemeCommon::uninstall_default_theme($this->get_type());
	Utils_RecordBrowserCommon::uninstall_recordset('SCTV_Payment');
	
	Utils_RecordBrowserCommon::unregister_processing_callback('SCTV_Payment', array('SCTV_PaymentCommon', 'process_request'));
	return true;
}
 
    public function info() {
         return array( 'Author'=>'Pham Huu Le Quoc Phuc', 'License'=>'SCTV','Description'=>'Payment');
    }
 
    public function simple_setup() {
        return array('package' => __('Payment'), 'version'=>'1.0');
    }
 
    public function requires($v) {
        return array(); 
    }
 
    public function version() {
        return array('1.0');
    }
}
?>